package com.daocao.hua.util;


import android.text.TextUtils;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;

public class URLCoder {
    public URLCoder() {
    }

    public static String encode(String str) {
        return encode(str, "UTF-8");
    }

    public static String encode(String str, String enc) {
        try {
            if (TextUtils.isEmpty(str)) return "";
            return URLEncoder.encode(str, enc);
        } catch (UnsupportedEncodingException var3) {
            var3.printStackTrace();
            return "";
        }
    }

    public static String decode(String str) {
        return decode(str, "UTF-8");
    }

    public static String decode(String str, String enc) {
        try {
            if (TextUtils.isEmpty(str)) return "";
            return URLDecoder.decode(str, enc);
        } catch (UnsupportedEncodingException var3) {
            var3.printStackTrace();
            return "";
        }
    }

//    public static enum MCharset {
//        private MCharset() {
//        }
//    }
}
